<layout name="layout"/>

<!-- 搜索 -->
<div class="form-div search_form_div">
    <form action="__ACTION__" method="GET" name="search_form">
        <p>
            订单号：
            <input type="text" name="ddh" size="30" value="<?php echo I('get.ddh'); ?>"/>
        </p>
        <p>
            提现人：
            <input type="text" name="name" size="30" value="<?php echo I('get.name'); ?>"/>
        </p>
        <p>
            状态：
            <input type="radio" name="zt" value="1">未结算
            <input type="radio" name="zt" value="2">已结算
            <input type="radio" name="zt" value="3">已驳回
        </p>
        <p><input type="submit" value=" 搜索 " class="button"/></p>
    </form>
</div>
<!-- 列表 -->
<div class="list-div" id="listDiv">
    <table class="table table-hover text-center">
        <tr>
            <th>订单号</th>
            <th>申请时间</th>
            <th>提款人姓名</th>
            <th>提现费率</th>
            <th>提现金额</th>
            <th>状态</th>
            <th width="300">操作</th>
        </tr>
        <?php foreach ($data as $k => $v): ?>
        <tr class="tron">
            <td><?php echo $v['ddh']; ?></td>
            <td><?php echo date('Y-m-d H:i:s',$v['time']); ?></td>
            <td><?php echo $v['name']; ?></td>
            <td><?php echo $v['txfl']; ?></td>
            <td><?php echo $v['money']; ?></td>
            <td><?php if($v['zt']==1){echo "未结算";}elseif($v['zt']==2){echo "已结算";}elseif($v['zt']==3){ echo "已驳回";}else{echo "已取消 ";} ?></td>
            <td align="center">
                <?php if($v['zt']==1){?>
                <a class="button border-red del" style="cursor: pointer" onclick="change(this)"
                   url="<?php echo U('edit?id='.$v['id'].'&p='.I('get.p')); //应该为付款api?>"
                   title="确认结算"> <span class="icon-trash-o"></span>确认结算</a>
                <a class="button border-red del" style="cursor: pointer" onclick="del(this)"
                   url="<?php echo U('del?id='.$v['id'].'&p='.I('get.p')); //应该为付款api?>"
                   title="驳回"> <span class="icon-trash-o"></span>驳回</a>
                <?php }?>
            </td>
        </tr>
        <?php endforeach; ?>
        <?php if(preg_match('/\d/', $page)): ?>
        <tr>
            <td colspan="10">
                <?php echo $page; ?>
            </td>
        </tr>
        <?php endif; ?>
    </table>
</div>

<script>
    function change(obj) {
        if (confirm('确认结算吗？')) {
            $.get($(obj).attr('url'), function (res) {
                alert(res.info);
                location.href = res.url;
            })
        }
    }

    function del(obj) {
        if (confirm('确认驳回吗？')) {
            $.get($(obj).attr('url'), function (res) {
                alert(res.info);
                location.href = res.url;
            })
        }
    }

</script>

